{$contents}

{literal}
<div style="text-align:left; padding:10px;">
<h2>DomFgF</h2>

<pre>
$$new = $$id == 0;
$$item = $$new ? new ${className}() : ${className}::load($$id);
		
$$post = DomFgPost::getInstance();

if( $$post->save ) {
	
	$$item->name = $$post->name;
	
	if( $$item->save() ) {
		$$id = $$item->id;
		$$message = array('type' => 'ok','colspan' => 2,'message' => 'Salvestatud',);
	} else {
		$$message = array('message' => 'Tekkinud on viga!','type' => 'ok','colspan' => 2,'description' => implode('<br>',$$item->getValidationReport()->messages),);
	}
}
		
$$panel = array(
	'title' => '${title}',
	'layout' => 'table',
	'action' => $$this->getUrl('${function_container}/'.$$id),
	'layoutConfig' => array(
		'columns' => 2,
		'columnWidths' => array( 150 ),
	),
	'items' => array(
		$$message ,
		array(
			'type' => 'textField',
			'title' => 'Nimi',
			'value' => $$item->name,
			'name' => 'name',
		),
	),
	'buttons' => array(
		array(
			'title' => 'Salvesta',
			'name' => 'save'
		),
	),
);
		
$$this->view->contents = DomFg::render( $$panel );
</pre>
</div>
{/literal}